precision mediump float;
varying vec2 v_VertTexCoord;

uniform float u_Time;
uniform sampler2D u_FireTexture;
uniform sampler2D u_MaskTexture;
uniform sampler2D u_DispTexture;

void main()
{	
	float dMax = 0.1;
	vec2 vDispComponent = texture2D(u_DispTexture, vec2(v_VertTexCoord.x, v_VertTexCoord.y + u_Time)).rg;
	vec2 offset = (2.0 * vDispComponent - 1.0) * dMax;
	vec4 cFireComponent = texture2D(u_FireTexture, v_VertTexCoord + offset);
	//vec4 cFireComponent = texture2D(u_FireTexture, v_VertTexCoord);
	vec4 cAlphaValue = texture2D(u_MaskTexture, v_VertTexCoord);
	vec4 cFinal = cFireComponent * vec4(1.0, 1.0, 1.0, cAlphaValue.r);
	gl_FragColor = cFinal;
}
